package de.karlNet.gifSocket.controllers;

import java.io.IOException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import de.karlNet.gifSocket.SessionStorage;
import de.karlNet.gifSocket.controllers.interfaces.IMouseController;
import de.karlNet.gifSocket.controllers.interfaces.ISession;

@Controller
@RequestMapping(value = "mouse")
public class MouseController implements IMouseController {
	@Autowired
	private SessionStorage sessionStorage;

	@RequestMapping(value = "/right_click", method = RequestMethod.GET)
	public @ResponseBody
	void rightClick(int sessionID, Integer x, Integer y) throws IOException {
		ISession session = this.sessionStorage.getSession(sessionID);
		session.rightClick(x, y);
	}

	@RequestMapping(value = "/click", method = RequestMethod.GET)
	public @ResponseBody
	void leftClick(int sessionID, Integer x, Integer y) throws IOException {
		ISession session = this.sessionStorage.getSession(sessionID);
		session.leftClick(x, y);
	}
}
